/*  This file is part of Cobra.

    Cobra is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Cobra is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Cobra.  If not, see <http://www.gnu.org/licenses/>.

    http://code.google.com/p/cobra-extension/
    Igor Demyanov Igor.demyanov@gmail.com
    Dmitry Gribanov tux.spb@gmail.com
*/
/*
How Cobra helps:

* Automatically generates strong passwords.
* One master key produces different passwords at many sites.
* Simple UI
* DOM Integration

Inspired by http://wijjo.com/Category/Passwordhasher
*/

window["Cobra_"+new Date().valueOf()]=
function (){

var $passwords = document.querySelectorAll('input[type="password"]')
if ($passwords.length == 0) {
	/* Password input not found */
	return;
}


function onPasswordFocus(e){
	CobraChromeExt.setCurrentPasswordElement(e.target);
}

CobraChromeExt.jsM($passwords,HTMLElement.prototype.addEventListener,["focus",onPasswordFocus,true]);

CobraChromeExt.createInvolvedWindow(CobraChromeExt.getDomain(document.location.host));

}();
